package com.mep.auth.controller;

import java.util.List;

import com.mep.auth.feign.IFeignSysLogApi;
import com.mep.auth.model.SysLog;
import com.mep.auth.service.SysLogService;
import com.mep.common.http.HttpResult;
import com.mep.common.page.PageRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 操作日志控制器
 * @author lyl
 * @date Jan 13, 2019
 */
@Api(value="005-log的controller",tags="005-log的controller")
@RestController
@RequestMapping("log")
public class SysLogController implements IFeignSysLogApi {

	@Autowired
	private SysLogService sysLogService;

	@Override
	@ApiOperation(value="01.log分页数据",notes="问题点:log分页数据")
	@ApiOperationSupport(order = 1, author = "lyl")
	@PostMapping(value="/findPage")
	public HttpResult findPage(@RequestBody PageRequest pageRequest) {
		return HttpResult.ok(sysLogService.findPage(pageRequest));
	}

	@Override
	@ApiOperation(value="02.删除log",notes="问题点:删除log")
	@ApiOperationSupport(order = 2, author = "lyl")
	@PostMapping(value="/delete")
	public HttpResult delete(@RequestBody List<SysLog> records) {
		return HttpResult.ok(sysLogService.delete(records));
	}
}
